<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>extends</title>
    <script type="text/javascript" src="../assets/js/vue-2.3.0.js"></script>
</head>

<body>
    <h1>extends</h1>
    <hr>
    <div id="app">
        {{num}}
        <p><button @click="add" @click='add2'>add</button></p>
        <p><button @click="add2" @click='add2'>add</button></p>
    </div>
</body>
<script type="text/javascript">
    var extendsobj = {
        updated:function(){
            console.log("我是被扩展出来的");
        },
        methods:{
            add2:function(){
                console.log('我是被扩展出来的方法！');
            }
        }
    }
    var app = new Vue({
        el: '#app',
        data: {
            num: 3
        },
        methods: {
            add:function(){
                console.log('我是原生方法');
                this.num++;
            }
        },
        updated:function(){
            console.log('我是原生的updated');
        },
        extends:extendsobj
    })
</script>

</html>